<template>
     <div class="container">
          <el-card>
               <div class="box">
                    <img :src="userAvater" alt="" class="avatar" />
                    <div class="bottom">
                         <h3 class="title">{{ getTime() }}好呀{{ userStore.username }}</h3>
                         <p class="subtitle">{{ setting.title }}</p>
                    </div>
               </div>
          </el-card>
     </div>
</template>

<script setup lang="ts">
// 1.首先，我们需要引入toRefs函数：import { reactive, toRefs } from ‘vue’;
// 我们使用toRefs函数将响应式对象转换为普通对象：const objRefs = toRefs(obj);
import { getTime } from '@/utils/time'
//引入用户相关的仓库,获取当前用户的头像、昵称
import useUserStore from '@/store/modules/user'
import setting from '@/setting.ts'
//获取存储用户信息的仓库对象
let userStore = useUserStore()
const userAvater = computed(() => {
     return userStore.avatar ? userStore.avatar : setting.logo
})
</script>

<style scoped lang="scss">
.container {
     width: 100%;
     height: 100%;
     // background: radial-gradient(ellipse at bottom, #1b2735, #090a0f);
     padding: 5px;
     overflow: hidden;
     position: relative;
}

.box {
     display: flex;

     .avatar {
          width: 100px;
          height: 100px;
          border-radius: 50%;
     }

     .bottom {
          margin-left: 20px;

          .title {
               font-size: 30px;
               font-weight: 900;
               margin-bottom: 30px;
          }

          .subtitle {
               font-style: italic;
               color: skyblue;
          }
     }
}
</style>
